<%@page import="com.mbbcpa.util.StringUtils"%>
<%@ page import = "java.io.*" %>
<%@ page import = "java.net.*" %>
<%@ page import = "java.text.*" %>
<%@ page import = "java.util.*" %>
<%@ page import = "java.util.Map" %>
<%@ page import = "java.util.HashMap" %>
<%@ page import="com.mbbcpa.app.manager.*" %>
<%@ page import="com.mbbcpa.app.EncryptionHelper" %>
<%@ page import="com.mbbcpa.app.EbppKeys" %>
<%@ page import="com.mbbcpa.util.*" %>
<%@ page import = "com.mbbcpa.security.dao.*" %>

<%
String msg = StringUtils.NullSafe((String) request.getAttribute("msg"));
String msg_id = StringUtils.NullSafe((String) request.getAttribute("msg_id"));

String userid = StringUtils.NullSafe((String) request.getAttribute("userid"));
String pass1 = StringUtils.NullSafe((String) request.getAttribute("pass1"));
String pass2 = StringUtils.NullSafe((String) request.getAttribute("pass2"));

boolean showParam = false;
String msgColor = "red";

if (msg_id.equalsIgnoreCase("MSG001") || msg_id.equalsIgnoreCase("MSG002"))
	showParam = true;

if (msg_id.equalsIgnoreCase("MSG999"))
	msgColor = "green";

ArrayList secGroupAccessList = (ArrayList) session.getAttribute(Constants.LOGON_ACCESS_LIST);
SecUserDao oSecUserDao = (SecUserDao) session.getAttribute(Constants.LOGGED_USER);
String sUserName = oSecUserDao.getUserName();
String lastLogonDateTime = (String) session.getAttribute(Constants.LAST_LOGON_DATETIME);

String selected = "sec007";
int iSec001 = 0;
int iSec002 = 0;
int iSec003 = 0;
int iSec004 = 0;
int iSec005 = 0;
int iSec006 = 0;
int iSec007 = 0;
int iSec008 = 0;

for(int i=0;i<secGroupAccessList.size();i++){
	SecAccessDao secaccessDao = (SecAccessDao)secGroupAccessList.get(i);
	String strModuleCode  = secaccessDao.getModuleCode();
	if(strModuleCode.equals("SEC001"))
		iSec001 = 1;
	if(strModuleCode.equals("SEC002"))
		iSec002 = 1;
	if(strModuleCode.equals("SEC003"))
		iSec003 = 1;
	if(strModuleCode.equals("SEC004"))
		iSec004 = 1;
	if(strModuleCode.equals("SEC005"))
		iSec005 = 1;
	if(strModuleCode.equals("SEC006"))
		iSec006 = 1;
	if(strModuleCode.equals("SEC007"))
		iSec007 = 1;
	if(strModuleCode.equals("SEC008"))
		iSec008 = 1;
}


%>

<html>
<head>
<link rel="stylesheet" href="resource/mbb_sec_global.css" type="text/css" />
<link href="resource/style.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
	    window.history.forward();
	    function noBack() { window.history.forward(); }
	</script>
<style type="text/css"></style></head>


<SCRIPT LANGUAGE="JavaScript1.2">

	// Page Actions here...
	
	//onSubmit of frmPwdRegex
	function UpdatePwdRegex(){
		
		var param_value = document.frmUserPwdRegex.param_value.value;
		var param_name = "userPwdRegex";
		if(param_value==null || param_value==""){
			alert("Please Enter a new Regular Expression");
			return false;
		}

		document.frmUserPwdRegex.action='<%=response.encodeURL("UpdateSecParameter.do?dispatch=updParameter")%>';
		document.frmUserPwdRegex.submit();
	}
	
	function UpdatePwdHist(){
		
		var param_value = document.frmPwdHist.param_value.value;
		if(param_value==null || param_value==""){
			alert("Please enter a value for Password History");
			return false;
		}

		document.frmPwdHist.action='<%=response.encodeURL("UpdateSecParameter.do?dispatch=updParameter")%>';
		document.frmPwdHist.submit();
	}
	
	
	function UpdatePwdResetFlag(){
		
		var param_value = document.frmPwdResetFlag.param_value.value;
		if(param_value==null || param_value==""){
			alert("Please enter a value for Reset Flag");
			return false;
		}

		document.frmPwdResetFlag.action='<%=response.encodeURL("UpdateSecParameter.do?dispatch=updParameter")%>';
		document.frmPwdResetFlag.submit();
	}

</SCRIPT>
</head>


<%
	//on jsp load
%>

<body class="home" onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">

	<a name="top"></a>
	
<!-- Header -->
<%@ include file="/jsp/common/Header.jsp" %>	
<!-- End Header -->

<div id="bgWrapper">
		<div id="container">
		
					<div id="titleBar">
						<ul class="topBar">
							<li class="goBackBt"><a href="<%=request.getContextPath()%>/ShowSecurityHome.do?dispatch=init"></a></li>

							<li>
							  <h1>Parameter Setup</h1></li>
						</ul>
					</div>
		
					<div id="fullcontent">
		
						<!-- Security Navigation -->
						<%@ include file="SecurityNavigation.jsp" %>	
						<!-- End SecurityNavigation -->
			
			
						<div id="contentRightIn">
									
							<div id="moduleContainer">
							
							
									<!--  Module Title -->
									<table align="center" width=100% border="0" rules="cols" class="tblDetails">
										<thead>
											<tr>
												<th colspan="4">
													<h4>Password Validation</h4>
												</th>
											</tr>
										</thead>
											
										<tr class="even">
											<td colspan="2" align="center" style="text-align:center !important;">
												Setup Password Rules, Total of Password History, Password Reset Flag.
												<p style="font-weight:bold;color: <%=msgColor%> !important;"><%=msg%></p>
											</td>
										</tr>
									</table>

									
									<!-- Data Table -->							
									
									<!-- Pasword Regular Expression -->	
									<form name="frmUserPwdRegex" action="" method="post">
										<table align="center" class="tbldetails" width=100% border="0" rules="cols">
											<thead class="th1">
												<tr>
													<th colspan="4">
														<div class="sectionTableTitle">
														<h3>Add/Edit Pasword Regular Expression</h3>
														</div>
													</th>
											</thead>
										
											<tr class="headerD">
												<td>Enter The Password Regular Expession Rule Below and click "Save" to proceed</td>
											</tr>
											
											<tr class="odd">
												<td>Enter Password Regular Expression Rule: 
													<input id="param_value" name="param_value" type="text" /> 
													<input type="hidden" value="userPwdRegex" name="param_name" /> 
													<input type="submit" value="Save" onClick="UpdatePwdRegex()" />								
												</div>
												</td>
											
											</tr>
											
											<tr class="even">
												<td>Note: For guidance, please refer this URL: <a href="http://www.roblocher.com/technotes/regexp.aspx" target="_blank">http://www.roblocher.com/technotes/regexp.aspx</a></td>
											</tr>	
										</table>
									</form>
									
									<!-- Pasword History Configuration -->	
									<form name="frmPwdHist" action="" method="post">
										<table align="center" class="tbldetails" width=100% border="0" rules="cols">
											<thead class="th1">
												<tr>
													<th colspan="4">
														<div class="sectionTableTitle">
														<h3>Add/Edit Total of Pasword History Configuration</h3>
														</div>
													</th>
											</thead>
										
											<tr class="headerD">
												<td>Enter The Total of Password History Stored Below and click "Save" to Proceed</td>
											</tr>
											
											<tr class="odd">
												<td>Enter Total of Password History Stored: <input id="param_value" name="param_value" type="text" /> 
												<input type="hidden" value="T_PWD_HIST" name="param_name" /> 
												<input type="submit" onclick="UpdatePwdHist()" value="Save" /></td>
											</tr>
												
										</table>
									</form>

									
									<!-- Pasword Reset Flag -->	
									<form name="frmPwdResetFlag" action="" method="post">
										<table align="center" class="tbldetails" width=100% border="0" rules="cols">
											<thead class="th1">
												<tr>
													<th colspan="4">
														<div class="sectionTableTitle">
														<h3>Add/Edit Password Reset Flag Coonfiguration</h3>
														</div>
													</th>
											</thead>
										
											<tr class="headerD">
												<td>Select The Password Reset Flagzz Below and click &quot;Save&quot; to proceed</td>
											</tr>
											
											<tr class="odd">
												<td>Select Password Reset Flag:Select Password Reset Flag:
												
												<select name="param_value"> 
												  	<option value="Y"> Yes</option>
												  	<option value="N"> No</option>
												</select>
												
												<input type="hidden" value="pwdResetFlag" name="param_name" />
												
												 <input type="submit" onclick="UpdatePwdResetFlag()" value="Save" /></td>
											</tr>
												
										</table>
									</form>
									
									<!--  Other Configuration -->
										
									<table align="center" class="tbldetails" width=100% border="0" rules="cols">
											<thead class="th1">
												<tr>
													<th colspan="4">
														<div class="sectionTableTitle">
														<h3>Other Configuration</h3>
														</div>
													</th>
											</thead>
										
										<tr class="headerD">
											<td width="40%" class="center_note">Configuration</td>
											<td width="60%" class="center_note">Description</td>
										</tr>
											
										<tr class="odd">
												<td>Session Time</td>
												<td>Edit the figure of session time at/app/deploy/mbbcsr/WEB-INF/web.xml</td>
										</tr>	

										<tr class="even">
												<td>User password & ID must not be the same</td>
												<td>Edit the flag of LoginPasswordCanMatchLoginid at /app/cfi/v55/config/siteoverrides/site_security.xml</td>
										</tr>		
										
										<tr class="odd">
												<td>Password Expire in number of days</td>
												<td>Edit the figure of CustomerPasswordExpiryDays at /app/cfi/v55/config/siteoverrides/site_security.xml</td>
										</tr>	
										
										<tr class="even">
												<td>Locked user after failed attempt</td>
												<td>Edit the figure of CustomerMaxBadAttempts at /app/cfi/v55/config/siteoverrides/site_security.xml</td>
										</tr>										

										<tr class="odd">
												<td>Force change password when Password Expire</td>
												<td>Edit the flag of ExpirePasswordOnReset at /app/cfi/v55/config/siteoverrides/site_security.xml</td>
										</tr>																					
												
									</table>
									
									
									
							
							</div> <!--  moduleContainer END -->
						</div>
		
					<!-- Footer -->
					<%@ include file="/jsp/common/Footer.jsp" %>	
					<!-- End Footer -->
					</div>




</body>
</html>